package com.foxzzz.two.pointers;

/**
 * @author: [wujie]
 * @createTime: [2019/7/15 19:37]
 * @description:
 */
public class Solution27 {

    public int removeElement(int[] nums, int val) {

        int i = 0;
        for (int j = 0; j < nums.length; j++) {
            if (nums[j] != val) {
                nums[i++] = nums[j];
            }

        }
        return i;
    }

    public static void main(String[] args) {
        System.out.println(new Solution27().removeElement(new int[]{3,2,2,3},3));
        System.out.println(new Solution27().removeElement(new int[]{0,1,2,2,3,0,4,2},2));
    }
}
